package cn.kbyue.logdemo.controller;

import cn.kbyue.logdemo.service.LogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/log")
@RequiredArgsConstructor
public class LogController {

    private final LogService logService;

    @GetMapping("/list")
    public ResponseEntity<String> list() {

        log.debug("[debug] 访问 log/list 接口 ");
        log.info("[info] 访问 log/list 接口 ");
        log.warn("[warn] 访问 log/list 接口 ");
        log.error("[error] 访问 log/list 接口 ");

        log.info("[info] 敏感信息: 手机号: 500235199412169110");
        log.info("[info] 敏感信息: 身份证号: 18723618275");

        logService.testAsync();

        return ResponseEntity.ok("success!");
    }

}
